const Joi = require('Joi');
const GROUP_NAME = "order";
const { jwtHeaderDefine } = require('../utils/router-helper');
module.exports = [
    {
        method: 'GET',
        path: '/',
        handler: (request, h) => {
            return 'Hello, world!';
        },
        config: {
            tags: ['api', 'tests'],
            description: '测试hello-world',
            auth: false,
        },
    },
    {
        method: 'POST',
        path: '/testjwt',
        handler: (request, h) => {
            return 'Hello, !';
        },
        config: {
            tags: ['api', 'tests'],
            description: '测试参数传递',
            validate: {
                ...jwtHeaderDefine,
            }
        },
    },
    {
        method: 'GET',
        path: '/2/{orderId}',
        handler: (request, h) => {
            return 'Hello, ' + encodeURIComponent(request.params.orderId) + '!';
        },
        config: {
            tags: ['api', GROUP_NAME],
            description: '测试订单数据',
            validate: {
                params: Joi.object({
                    orderId: Joi.string().required(),
                  })
            }
        },
    }
]